package com.whsxt.common;

/**
 * @Author 武汉尚学堂
 * 统一数据的返回结果
 */
public class Result {


    private Integer code;//业务码  200

    private String msg;// 业务消息  成功

    private Object data;//业务数据

    /**
     * 默认的业务结果对象
     */
    public Result (){
        this.code = CodeMsg.SUCCESS.code;
        this.msg = CodeMsg.SUCCESS.msg;
    }

    /**
     * 不正常时 业务结果
     * @param codeMsg
     */
    public Result(CodeMsg codeMsg){
        this.code = codeMsg.code;
        this.msg = codeMsg.msg;
    }

    /**
     * 业务正常 且有返回数据的构造方法
     * @param data
     */
    public Result(Object data){
        this();//调用无参构造
        this.data = data;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
